package com.zhongketech.sunflower.database;

import com.zhongketech.sunflower.util.Constants;
import com.zhongketech.sunflower.util.Utilities;

import android.content.ContentValues;

/**
 * 电话号码相关信息
 * @author 905904
 *
 */
public class PhoneNumberData  {

	private final static String TAG = "PhoneNumberData";
	private final static String numberKey = "num";
	private final static String nameKey = "name";
	ContentValues cv = new ContentValues();
	public PhoneNumberData(String number, String name)
	{
		cv.put(nameKey, name);
		cv.put(numberKey, number);
	}

	public String getNumber()
	{
		return cv.getAsString(numberKey);
	}

	public String getName()
	{
		return cv.getAsString(nameKey);
	}

	public ContentValues getContentValues()
	{
		return cv;
	}
	
	public int getStatus(PhoneNumberData num)
	{
		if(null != getNumber() && null != num.getNumber())
		{
			if(getNumber().equals(num.getNumber()))
			{
				Utilities.logCat(TAG, "the number is same", Constants.LOG_INFO);
				return Constants.ITEM_EXISTS;
			}

		}
		else if(null != getName() && null != num.getName())
		{
			if(getName().equals(num.getName()))
			{
				Utilities.logCat(TAG, "the name is same", Constants.LOG_INFO);
				return Constants.ITEM_EXISTS;
			}
		}
		
		
		return Constants.ITEM_ADD;
	}
}
